<script setup lang="ts">
import { useLocalStorage } from '@peng_kai/kit/libs/vueuse';
import Mobile from '~/pages/invitation/Mobile.vue';
import PC from '~/pages/invitation/PC.vue';
import { useList } from './hooks';

const { isSuccess, list } = useList();
const router = useRouter();
const invitedSinpStorage = useLocalStorage('invitedSpin', {jump: false});

const stop = watch(isSuccess, (c) => {
  if (c && list.value.length === 0) {
    router.push('/');
    stop();
  }
});

onMounted(() => {
  if (!invitedSinpStorage.value.jump) {
    invitedSinpStorage.value.jump = true;
  }
});
</script>

<template>
  <div class="page-content-w">
    <Mobile />
    <PC />
  </div>
</template>
